<template>
  <div class="app-container">
<!--    <el-form-->
<!--      :model="queryParams"-->
<!--      ref="queryForm"-->
<!--      :inline="true"-->
<!--      v-show="showSearch"-->
<!--      label-width="120px"-->
<!--    >-->
<!--      <el-form-item label="设备名称" prop="field4">-->
<!--        <el-input-->
<!--          v-model="queryParams.field4"-->
<!--          placeholder="请输入设备名称"-->
<!--          clearable-->
<!--          size="small"-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item>-->
<!--        <el-button-->
<!--          type="primary"-->
<!--          icon="el-icon-search"-->
<!--          size="mini"-->
<!--          @click="handleQuery"-->
<!--        >搜索</el-button-->
<!--        >-->
<!--        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"-->
<!--        >重置</el-button-->
<!--        >-->
<!--      </el-form-item>-->
<!--    </el-form>-->

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          v-if="false"
          @click="handleAdd"
          v-hasPermi="['biz:jdssrcxc:add']"
        >新增</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          v-if="false"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['biz:jdssrcxc:edit']"
        >修改</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          v-if="false"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['biz:jdssrcxc:remove']"
        >删除</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          :loading="exportLoading"
          @click="handleExport"
          v-hasPermi="['biz:jdssrcxc:export']"
        >导出</el-button
        >
      </el-col>
      <right-toolbar
        :showSearch.sync="showSearch"
        @queryTable="getList"
      ></right-toolbar>
    </el-row>

    <el-table
      v-loading="loading"
      :data="jdssrcxcList"
      row-key="id"
      stripe
      :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
      @selection-change="handleSelectionChange"
    >
      <el-table-column label="设备编码" align="center" prop="field1" />
      <el-table-column label="设备名称" align="center" prop="field2" />
      <el-table-column label="检查项目" align="center" prop="field3" />
      <el-table-column label="检查内容" align="center" prop="field4" />
<!--      <el-table-column label="设备状态" align="center" prop="field5">-->
<!--        <template slot-scope="scope">-->
<!--          <el-tag-->
<!--            :type=tagjudge(scope.row.field5)-->
<!--            @click=tagclick(scope.row)-->
<!--            disable-transitions>-->
<!--            {{scope.row.field5}}-->
<!--          </el-tag>-->
<!--        </template>-->
<!--      </el-table-column>-->
<!--      <el-table-column-->
<!--        label="操作"-->
<!--        align="center"-->
<!--        class-name="small-padding fixed-width"-->
<!--      >-->
<!--        <template slot-scope="scope">-->
<!--          <el-button-->
<!--            size="mini"-->
<!--            type="text"-->
<!--            icon="el-icon-edit"-->
<!--            @click="handleUpdate(scope.row)"-->
<!--            v-hasPermi="['biz:jdssrcxc:edit']"-->
<!--          >修改</el-button-->
<!--          >-->
<!--          <el-button-->
<!--            size="mini"-->
<!--            type="text"-->
<!--            icon="el-icon-delete"-->
<!--            @click="handleDelete(scope.row)"-->
<!--            v-hasPermi="['biz:jdssrcxc:remove']"-->
<!--          >删除</el-button-->
<!--          >-->
<!--        </template>-->
<!--      </el-table-column>-->
    </el-table>

    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改机电设施日常巡查对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="40%" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
        <el-form-item label="隧道名称" prop="field1">
          <el-select v-model="form.field1" placeholder="请选择隧道名称">
            <el-option
              v-for="dict in suidaoList"
              :key="dict.id + ''"
              :label="dict.field2"
              :value="dict.field2 + ''"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="养护机构" prop="field2">
          <el-input v-model="form.field2" placeholder="请输入养护机构" />
        </el-form-item>
        <el-form-item label="设备名称" prop="field4">
          <!--          <el-select v-model="form.field4" placeholder="请选择设备">-->
          <!--            <el-option-->
          <!--              v-for="dict in shebeiList"-->
          <!--              :key="dict.id + ''"-->
          <!--              :label="dict.field2"-->
          <!--              :value="dict.id + ''"-->
          <!--            ></el-option>-->
          <!--          </el-select>-->
          <el-cascader
            placeholder="请选择设备名称"
            v-model="form.field4"
            :options="shebeiList">
          </el-cascader>
        </el-form-item>
        <el-form-item label="检查日期" prop="field3">
          <el-date-picker
            clearable
            size="small"
            v-model="form.field3"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="选择检查日期"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="检查内容" prop="field5">
          <el-input v-model="form.field5" placeholder="请输入内容"/>
        </el-form-item>
        <el-form-item label="检查结果" prop="field6">
          <el-select v-model="form.field6" placeholder="请选择">
            <el-option
              v-for="item in results"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="车辆使用情况" prop="field7">
          <el-input v-model="form.field7" placeholder="请输入车辆使用情况" />
        </el-form-item>
        <el-form-item label="注意事项" prop="field8">
          <el-input v-model="form.field8" placeholder="请输入内容"/>
        </el-form-item>
        <el-form-item label="检查人" prop="field9">
          <el-input v-model="form.field9" placeholder="请输入检查人" />
        </el-form-item>
        <el-form-item label="记录人" prop="field10">
          <el-input v-model="form.field10" placeholder="请输入记录人" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {
  listJdssrcxc,
  getJdssrcxc,
  delJdssrcxc,
  addJdssrcxc,
  updateJdssrcxc,
  exportJdssrcxc,
} from "@/api/biz/jdssrcxc";
import { listSuidao } from "@/api/biz/suidao";
import { listShebei } from "@/api/biz/shebei";
import { exportJiankongyutongxin } from "@/api/biz/jidiansheshijiankongyutongxin";

export default {
  name: "Jdssrcxc",
  data() {
    return {
      results: [{
        value: '正常',
        label: '正常'
      }, {
        value: '异常',
        label: '异常'
      },{
        value: '异常且严重',
        label: '异常且严重'
      }
      ],
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 隧道信息表格数据
      suidaoList: [],
      // 设备管理表格数据
      shebeiList: [],
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 机电设施日常巡查表格数据
      jdssrcxcList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        field1: null,
        field2: null,
        field3: null,
        field4: null,
        field5: null,
        field6: null,
        field7: null,
        field8: null,
        field9: null,
        field10: null,
        type: null,
        num: null,
        status: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        field1: [
          { required: true, message: "隧道名称不能为空", trigger: "blur" },
        ],
        field2: [
          { required: true, message: "养护机构不能为空", trigger: "blur" },
        ],
        field3: [
          { required: true, message: "检查日期不能为空", trigger: "blur" },
        ],
        field4: [
          { required: true, message: "设备名称不能为空", trigger: "blur" },
        ],
        field5: [
          { required: true, message: "检查内容不能为空", trigger: "blur" },
        ],
        field6: [
          { required: true, message: "检查结果不能为空", trigger: "blur" },
        ],
        field7: [
          { required: true, message: "车辆使用情况不能为空", trigger: "blur" },
        ],
        field8: [
          { required: true, message: "注意事项不能为空", trigger: "blur" },
        ],
        field9: [
          { required: true, message: "检查人不能为空", trigger: "blur" },
        ],
        field10: [
          { required: true, message: "记录人不能为空", trigger: "blur" },
        ],
      },
    };
  },
  mounted() {
    this.getList();
    listSuidao({}).then((response) => {
      this.suidaoList = response.rows;
    });
    listShebei({}).then((response) => {
      // this.shebeiList = response.rows
      //data是要被分组的数据[]，key是分组依据的关键字
      // 5-类型 2-名称
      let groups =this.getGroup(response.rows,'field5')
      let options = []
      for(const key in groups){
        if (Object.getOwnPropertyDescriptor(groups,key)){
          options.push({
            value:key,
            label:key,
            children:groups[key].map(item=>{
              return {
                value:item.field2,
                label:item.field2
              }
            })
          })
        }
      }
      this.shebeiList = options
    });
  },
  methods: {
    tagjudge(x){
      if(x === "异常"){
        return "danger"
      }
      else if(x === "正常"){
        return "success"
      }
      else {
        return ""
      }
    },
    tagclick(x) {
      if(x.field5 === "异常"){
        x.field5 = "正常"
      }
      else if(x.field5 === "正常"){
        x.field5 = "异常"
      }
      else{
        return " "
      }
    },
    getGroup(data,key){
      let groups={};
      data.forEach(c=>{
        let value=c[key];
        groups[value]=groups[value]||[];
        groups[value].push(c);
      });
      return groups;
    },
    /** 查询机电设施日常巡查列表 */
    getList() {
      this.loading = true;
      listJdssrcxc(this.queryParams).then((response) => {
        // this.jdssrcxcList = response.rows;
        this.jdssrcxcList = [
          {
            id: 1,
            field1: "50100",
            field2: "亮度检测器",
            field3: " ",
            field4: " ",
            field5: " ",
            children: [{
              id: 11,
              field1: "50100",
              field2: "亮度检测器",
              field3: "总体",
              children: [{
                id: 111,
                field1: "50100",
                field2: "亮度检测器",
                field3: "总体",
                field4: "有无误差",
                field5: "正常",
              }, {
                id: 112,
                field1: "50100",
                field2: "亮度检测器",
                field3: "总体",
                field4: "安装是否松动等",
                field5: "正常",
              }, {
                id: 113,
                field1: "50100",
                field2: "亮度检测器",
                field3: "总体",
                field4: "仪器检测精度标定",
                field5: "正常",
              }],
            },
            ],
            },{
            id:2,
            field1: "50200",
            field2: "能见度检测器",
            field3: " ",
            field4: " ",
            field5: " ",
            children: [{
              id: 21,
              field1: "50200",
              field2: "能见度检测器",
              field3: "感光单元",
              children: [{
                id: 211,
                field1: "50200",
                field2: "能见度检测器",
                field3: "感光单元",
                field4: "外观有无污染、损伤",
                field5: "正常",
              },{
                id: 212,
                field1: "10200",
                field2: "能见度检测器",
                field3: "感光单元",
                field4: "聚焦镜防护罩全面检查",
                field5: "正常",
              },
              ],
            },{
              id:22,
              field1: "50200",
              field2: "能见度检测器",
              field3: "监控单元",
              children: [{
                id: 221,
                field1: "50200",
                field2: "能见度检测器",
                field3: "监控单元",
                field4: "外观是否有污染、损伤",
                field5: "正常",
              }, {
                id: 222,
                field1: "50200",
                field2: "能见度检测器",
                field3: "监控单元",
                field4: "调整工作状态、透过率指标",
                field5: "正常",
              }, {
                id: 223,
                field1: "50200",
                field2: "能见度检测器",
                field3: "监控单元",
                field4: "计量仪、显示器、故障显示灯是否正常",
                field5: "正常",
              },{
                id: 224,
                field1: "50200",
                field2: "能见度检测器",
                field3: "监控单元",
                field4: "操作开关、继电器、电磁开关、配线断路器是否正常",
                field5: "正常",
              },{
                id: 225,
                field1: "50200",
                field2: "能见度检测器",
                field3: "监控单元",
                field4: "配线有无异常、污染、损伤、过热、松动、断线等",
                field5: "正常",
              },
              ],
            },{
              id: 23,
              field1: "50200",
              field2: "能见度检测器",
              field3: "仪器标定",
              field4: "仪器整体检测精度",
              field5: "正常",
            }
          ],
          },{
            id:3,
            field1: "50300",
            field2: "CO检测器",
            field3: " ",
            field4: " ",
            field5: " ",
            children: [{
              id: 31,
              field1: "50300",
              field2: "CO检测器",
              field3: "分析仪及自动校正装置",
              children: [{
                id: 311,
                field1: "50300",
                field2: "CO检测器",
                field3: "分析仪及自动校正装置",
                field4: "确认分析仪的指示值是否正确",
                field5: "正常",
              },{
                id: 312,
                field1: "50300",
                field2: "CO检测器",
                field3: "分析仪及自动校正装置",
                field4: "空气过滤器是否有污染",
                field5: "正常",
              },{
                id: 313,
                field1: "50300",
                field2: "CO检测器",
                field3: "分析仪及自动校正装置",
                field4: "确认除湿装置的功能",
                field5: "正常",
              },{
                id: 314,
                field1: "50300",
                field2: "CO检测器",
                field3: "分析仪及自动校正装置",
                field4: "确认自动校正装置的功能",
                field5: "正常",
              },{
                id: 315,
                field1: "50300",
                field2: "CO检测器",
                field3: "分析仪及自动校正装置",
                field4: "检查通风装置的功能",
                field5: "正常",
              },
              ],
            },{
              id:32,
              field1: "50300",
              field2: "CO检测器",
              field3: "吸气装置",
              children: [{
                id: 321,
                field1: "50300",
                field2: "CO检测器",
                field3: "吸气装置",
                field4: "吸气泵的运转有无异响、过热、振动",
                field5: "正常",
              }, {
                id: 322,
                field1: "50300",
                field2: "CO检测器",
                field3: "吸气装置",
                field4: "外观有无污染、损伤",
                field5: "正常",
              },{
                id: 323,
                field1: "50300",
                field2: "CO检测器",
                field3: "吸气装置",
                field4: "检查检测仪读数有无异常",
                field5: "正常",
              }, ],
            },{
              id: 33,
              field1: "50300",
              field2: "CO检测器",
              field3: "采气口",
              field4: "隧道采气口过滤器的更换",
              field5: "正常",
            },{
              id: 34,
              field1: "50300",
              field2: "CO检测器",
              field3: "监控单元",
              field4: "按“能见度检测器”中“监控单元”执行",
              field5: "正常",
            },{
              id: 35,
              field1: "50300",
              field2: "CO检测器",
              field3: "仪器标定",
              field4: "仪器整体检测精度",
              field5: "正常",
            }
            ],
          },{
            id:4,
            field1: "50400",
            field2: "风速风向检测器",
            field3: " ",
            field4: " ",
            field5: " ",
            children: [{
              id: 41,
              field1: "50400",
              field2: "风速风向检测器",
              field3: "分析仪及自动校正装置",
              children: [{
                id: 411,
                field1: "50400",
                field2: "风速风向检测器",
                field3: "分析仪及自动校正装置",
                field4: "确认分析仪的指示值是否正确",
                field5: "正常",
              }, {
                id: 412,
                field1: "50400",
                field2: "风速风向检测器",
                field3: "分析仪及自动校正装置",
                field4: "确认自动校正装置的功能",
                field5: "正常",
              },],
            },{
              id:42,
              field1: "50400",
              field2: "风速风向检测器",
              field3: "监控单元",
              field4: "按“能见度检测器”中“监控单元”执行",
              field5: "正常",
            },{
              id:43,
              field1: "50400",
              field2: "风速风向检测器",
              field3: "仪器标定",
              field4: "仪器整体检测精度",
              field5: "正常",
            },
            ],
          },{
            id:5,
            field1: "50500",
            field2: "车辆检测器",
            field3: " ",
            field4: " ",
            field5: " ",
            children: [{
              id: 51,
              field1: "50500",
              field2: "车辆检测器",
              field3: "检测单元",
              children: [{
                id: 511,
                field1: "50500",
                field2: "车辆检测器",
                field3: "检测单元",
                field4: "外观有无污染、损伤",
                field5: "正常",
              }, {
                id: 512,
                field1: "50500",
                field2: "车辆检测器",
                field3: "检测单元",
                field4: "检查动作及调整灵敏度",
                field5: "正常",
              }, {
                id: 513,
                field1: "50500",
                field2: "车辆检测器",
                field3: "检测单元",
                field4: "安装状态",
                field5: "正常",
              },],
            },{
              id: 52,
              field1: "50500",
              field2: "车辆检测器",
              field3: "监控单元",
              children: [{
                id: 521,
                field1: "50500",
                field2: "车辆检测器",
                field3: "监控单元",
                field4: "外观有无污染、损伤",
                field5: "正常",
              },{
                id: 522,
                field1: "50500",
                field2: "车辆检测器",
                field3: "监控单元",
                field4: "运行状态",
                field5: "正常",
              },{
                id: 523,
                field1: "50500",
                field2: "车辆检测器",
                field3: "监控单元",
                field4: "各种测量数据可靠度",
                field5: "正常",
              },{
                id: 524,
                field1: "50500",
                field2: "车辆检测器",
                field3: "监控单元",
                field4: "测量仪、显示器、故障显示灯有无异常",
                field5: "正常",
              },{
                id: 525,
                field1: "50500",
                field2: "车辆检测器",
                field3: "监控单元",
                field4: "测定传输电流",
                field5: "正常",
              },{
                id: 526,
                field1: "50500",
                field2: "车辆检测器",
                field3: "监控单元",
                field4: "电子线路板、继电器的安装状态",
                field5: "正常",
              },{
                id: 527,
                field1: "50500",
                field2: "车辆检测器",
                field3: "监控单元",
                field4: "柜内配线有无损伤、过热、松动、断线",
                field5: "正常",
              },{
                id: 528,
                field1: "50500",
                field2: "车辆检测器",
                field3: "监控单元",
                field4: "检测线圈绝缘电阻及电感量",
                field5: "正常",
              },
              ],
            },
            ],
          },{
            id:6,
            field1: "50601",
            field2: "闭路电视监控系统",
            field3: " ",
            field4: " ",
            field5: " ",
            children: [{
              id: 61,
              field1: "50601",
              field2: "闭路电视监控系统",
              field3: "摄像机",
              children: [{
                id: 611,
                field1: "50601",
                field2: "闭路电视监控系统",
                field3: "摄像机",
                field4: "外观有无污染、损伤",
                field5: "正常",
              }, {
                id: 612,
                field1: "50601",
                field2: "闭路电视监控系统",
                field3: "摄像机",
                field4: "动作确认",
                field5: "正常",
              }, {
                id: 613,
                field1: "50601",
                field2: "闭路电视监控系统",
                field3: "摄像机",
                field4: "电流电压测量",
                field5: "正常",
              },{
                id: 614,
                field1: "50601",
                field2: "闭路电视监控系统",
                field3: "摄像机",
                field4: "调整聚焦及焦距",
                field5: "正常",
              },],
            },{
              id: 62,
              field1: "50602",
              field2: "闭路电视监控系统",
              field3: "编解码器",
              field4: "编解码是否正常",
              field5: "正常",
            },{
              id: 63,
              field1: "50603",
              field2: "闭路电视监控系统",
              field3: "视频矩阵",
              field4: "视频切换、控制是否正常",
              field5: "正常",
            },{
              id: 64,
              field1: "50604",
              field2: "闭路电视监控系统",
              field3: "监视器",
              children: [{
                id: 641,
                field1: "50604",
                field2: "闭路电视监控系统",
                field3: "监视器",
                field4: "外观有无污染、损伤",
                field5: "正常",
              },{
                id: 642,
                field1: "50604",
                field2: "闭路电视监控系统",
                field3: "监视器",
                field4: "图像是否清晰、稳定",
                field5: "正常",
              }],
            },{
              id: 65,
              field1: "50605",
              field2: "闭路电视监控系统",
              field3: "硬盘录像机",
              children: [{
                id: 651,
                field1: "50605",
                field2: "闭路电视监控系统",
                field3: "硬盘录像机",
                field4: "检查BNC接头",
                field5: "正常",
              },{
                id: 652,
                field1: "50605",
                field2: "闭路电视监控系统",
                field3: "硬盘录像机",
                field4: "测试硬盘录像机的指标",
                field5: "正常",
              }],
            },{
              id: 66,
              field1: "50699",
              field2: "闭路电视监控系统",
              field3: "安装部位",
              field4: "是否松动、锈蚀",
              field5: "正常",
            },{
              id: 67,
              field1: "50699",
              field2: "闭路电视监控系统",
              field3: "控制装置",
              children: [{
                id: 671,
                field1: "50699",
                field2: "闭路电视监控系统",
                field3: "控制装置",
                field4: "外观有无污染、损伤",
                field5: "正常",
              },{
                id: 672,
                field1: "50699",
                field2: "闭路电视监控系统",
                field3: "控制装置",
                field4: "操作是否灵敏、正常",
                field5: "正常",
              },{
                id: 673,
                field1: "50699",
                field2: "闭路电视监控系统",
                field3: "控制装置",
                field4: "与紧急电话等的联动试验",
                field5: "正常",
              },{
                id: 674,
                field1: "50699",
                field2: "闭路电视监控系统",
                field3: "控制装置",
                field4: "与防灾控制的联动试验",
                field5: "正常",
              },{
                id: 675,
                field1: "50699",
                field2: "闭路电视监控系统",
                field3: "控制装置",
                field4: "电压、电流测量",
                field5: "正常",
              },{
                id: 676,
                field1: "50699",
                field2: "闭路电视监控系统",
                field3: "控制装置",
                field4: "机内保养",
                field5: "正常",
              }],
            },{
              id: 68,
              field1: "50699",
              field2: "闭路电视监控系统",
              field3: "操作台",
              children: [{
                id: 681,
                field1: "50699",
                field2: "闭路电视监控系统",
                field3: "操作台",
                field4: "外观有无污染、损伤",
                field5: "正常",
              },{
                id: 682,
                field1: "50699",
                field2: "闭路电视监控系统",
                field3: "操作台",
                field4: "功能是否正常",
                field5: "正常",
              }],
            }
            ],
          },{
            id:7,
            field1: "50700",
            field2: "视频交通事件检测器",
            field3: " ",
            field4: " ",
            field5: " ",
            children: [{
              id: 71,
              field1: "50700",
              field2: "视频交通事件检测器",
              field3: "总体",
              children: [{
                id: 711,
                field1: "50700",
                field2: "视频交通事件检测器",
                field3: "总体",
                field4: "外观有无污染、损伤",
                field5: "正常",
              }, {
                id: 712,
                field1: "50700",
                field2: "视频交通事件检测器",
                field3: "总体",
                field4: "各种测量数据可靠度",
                field5: "正常",
              },],
            },
            ],
          },{
            id:8,
            field1: "50800",
            field2: "大屏幕投影系统",
            field3: " ",
            field4: " ",
            field5: " ",
            children: [{
              id: 81,
              field1: "50800",
              field2: "大屏幕投影系统",
              field3: "总体",
              children: [{
                id: 811,
                field1: "50800",
                field2: "大屏幕投影系统",
                field3: "总体",
                field4: "亮度一致性",
                field5: "正常",
              },{
                id: 812,
                field1: "50800",
                field2: "大屏幕投影系统",
                field3: "总体",
                field4: "色彩、分辨率",
                field5: "正常",
              },{
                id: 813,
                field1: "50800",
                field2: "大屏幕投影系统",
                field3: "总体",
                field4: "经图像拼接控制器的视频图像",
                field5: "正常",
              },{
                id: 814,
                field1: "50800",
                field2: "大屏幕投影系统",
                field3: "总体",
                field4: "经RGB矩阵的PC信号质量",
                field5: "正常",
              },{
                id: 815,
                field1: "50800",
                field2: "大屏幕投影系统",
                field3: "总体",
                field4: "经网络的PC信号质量",
                field5: "正常",
              },{
                id: 816,
                field1: "50800",
                field2: "大屏幕投影系统",
                field3: "总体",
                field4: "对视频矩阵的调用、切换",
                field5: "正常",
              },{
                id: 817,
                field1: "50800",
                field2: "大屏幕投影系统",
                field3: "总体",
                field4: "开关视频、PC信号窗口",
                field5: "正常",
              },{
                id: 818,
                field1: "50800",
                field2: "大屏幕投影系统",
                field3: "总体",
                field4: "电源测试",
                field5: "正常",
              },{
                id: 819,
                field1: "50800",
                field2: "大屏幕投影系统",
                field3: "总体",
                field4: "窗口缩放、移动、多视窗显示等",
                field5: "正常",
              },{
                id: 8110,
                field1: "50800",
                field2: "大屏幕投影系统",
                field3: "总体",
                field4: "图像参数调整",
                field5: "正常",
              },],
            },
            ],
          },{
            id:9,
            field1: "50900",
            field2: "地图板",
            field3: " ",
            field4: " ",
            field5: " ",
            children: [{
              id: 91,
              field1: "50900",
              field2: "地图板",
              field3: "总体",
              children: [{
                id: 911,
                field1: "50900",
                field2: "地图板",
                field3: "总体",
                field4: "日期、气象显示是否正确",
                field5: "正常",
              }, {
                id: 912,
                field1: "50900",
                field2: "地图板",
                field3: "总体",
                field4: "其他显示功能是否正常",
                field5: "正常",
              }, {
                id: 913,
                field1: "50900",
                field2: "地图板",
                field3: "总体",
                field4: "道路动态光带显示",
                field5: "正常",
              },{
                id: 914,
                field1: "50900",
                field2: "地图板",
                field3: "总体",
                field4: "亮度、色彩均衡和图像清晰度",
                field5: "正常",
              },{
                id: 915,
                field1: "50900",
                field2: "地图板",
                field3: "总体",
                field4: "电源测试",
                field5: "正常",
              },{
                id: 916,
                field1: "50900",
                field2: "地图板",
                field3: "总体",
                field4: "紧急电话摘、挂机信息显示",
                field5: "正常",
              },],
            },],
          },{
            id:10,
            field1: "51000",
            field2: "紧急电话及广播",
            field3: " ",
            field4: " ",
            field5: " ",
            children: [{
              id: 101,
              field1: "51000",
              field2: "紧急电话及广播",
              field3: "中波播音装置",
              children: [{
                id: 1011,
                field1: "51000",
                field2: "紧急电话及广播",
                field3: "中波播音装置",
                field4: "行车接听试验",
                field5: "正常",
              },{
                id: 1012,
                field1: "51000",
                field2: "紧急电话及广播",
                field3: "中波播音装置",
                field4: "外观有无污染、损伤",
                field5: "正常",
              },{
                id: 1013,
                field1: "51000",
                field2: "紧急电话及广播",
                field3: "中波播音装置",
                field4: "电压及输出功率测定",
                field5: "正常",
              },{
                id: 1014,
                field1: "51000",
                field2: "紧急电话及广播",
                field3: "中波播音装置",
                field4: "调制输入确认",
                field5: "正常",
              },{
                id: 1015,
                field1: "51000",
                field2: "紧急电话及广播",
                field3: "中波播音装置",
                field4: "设备清洁",
                field5: "正常",
              },],
            },{
              id: 102,
              field1: "51000",
              field2: "紧急电话及广播",
              field3: "扩音装置",
              children: [{
                id: 1021,
                field1: "51000",
                field2: "紧急电话及广播",
                field3: "扩音装置",
                field4: "外观有无污染、损伤",
                field5: "正常"
              },{
                id: 1022,
                field1: "51000",
                field2: "紧急电话及广播",
                field3: "扩音装置",
                field4: "电压、电流测量",
                field5: "正常"
              },{
                id: 1023,
                field1: "51000",
                field2: "紧急电话及广播",
                field3: "扩音装置",
                field4: "确认输出功率",
                field5: "正常"
              }]
            },{
              id: 103,
              field1: "51000",
              field2: "紧急电话及广播",
              field3: "操作平台",
              children: [{
                id: 1031,
                field1: "51000",
                field2: "紧急电话及广播",
                field3: "操作平台",
                field4: "外观有无污染、损伤",
                field5: "正常"
              },{
                id: 1032,
                field1: "51000",
                field2: "紧急电话及广播",
                field3: "操作平台",
                field4: "紧急播音试验",
                field5: "正常"
              },{
                id: 1032,
                field1: "51000",
                field2: "紧急电话及广播",
                field3: "操作平台",
                field4: "监控试验",
                field5: "正常"
              },{
                id: 1032,
                field1: "51000",
                field2: "紧急电话及广播",
                field3: "操作平台",
                field4: "电流、电压测量",
                field5: "正常"
              },],
            },{
              id: 104,
              field1: "51000",
              field2: "紧急电话及广播",
              field3: "话筒",
              children: [{
                id: 1041,
                field1: "51000",
                field2: "紧急电话及广播",
                field3: "话筒",
                field4: "外观检查",
                field5: "正常"
              },{
                id: 1041,
                field1: "51000",
                field2: "紧急电话及广播",
                field3: "话筒",
                field4: "紧急播音试验",
                field5: "正常"
              },],
            },{
              id: 105,
              field1: "51000",
              field2: "紧急电话及广播",
              field3: "扩音器",
              children: [{
                id: 1051,
                field1: "51000",
                field2: "紧急电话及广播",
                field3: "扩音器",
                field4: "安装状态检测",
                field5: "正常"
              },{
                id: 1052,
                field1: "51000",
                field2: "紧急电话及广播",
                field3: "扩音器",
                field4: "接听试验",
                field5: "正常"
              },],
            },{
              id: 106,
              field1: "51000",
              field2: "紧急电话及广播",
              field3: "紧急电话",
              children: [{
                id: 1061,
                field1: "51000",
                field2: "紧急电话及广播",
                field3: "紧急电话",
                field4: "外观有无污染、损伤",
                field5: "正常",
              },{
                id: 1062,
                field1: "51000",
                field2: "紧急电话及广播",
                field3: "紧急电话",
                field4: "通话效果试验",
                field5: "正常",
              },{
                id: 1063,
                field1: "51000",
                field2: "紧急电话及广播",
                field3: "紧急电话",
                field4: "内部检查",
                field5: "正常",
              },{
                id: 1064,
                field1: "51000",
                field2: "紧急电话及广播",
                field3: "紧急电话",
                field4: "测定输人、输出电流",
                field5: "正常",
              },{
                id: 1065,
                field1: "51000",
                field2: "紧急电话及广播",
                field3: "紧急电话",
                field4: "强制切断试验",
                field5: "正常",
              },{
                id: 1066,
                field1: "51000",
                field2: "紧急电话及广播",
                field3: "紧急电话",
                field4: "测定接地阻抗",
                field5: "正常",
              },
              ],
            },
            ],
          },{
            id:11,
            field1: "51100",
            field2: "本地控制器",
            field3: " ",
            field4: " ",
            field5: " ",
            children: [{
              id: 111,
              field1: "51100",
              field2: "本地控制器",
              field3: "总体",
              children: [{
                id: 1111,
                field1: "51100",
                field2: "本地控制器",
                field3: "总体",
                field4: "浪涌保护器检查",
                field5: "正常",
              },{
                id: 1112,
                field1: "51100",
                field2: "本地控制器",
                field3: "总体",
                field4: "加热器或散热器检查",
                field5: "正常",
              },{
                id: 1113,
                field1: "51100",
                field2: "本地控制器",
                field3: "总体",
                field4: "电源测试",
                field5: "正常",
              },{
                id: 1114,
                field1: "51100",
                field2: "本地控制器",
                field3: "总体",
                field4: "数据采集周期",
                field5: "正常",
              },{
                id: 1115,
                field1: "51100",
                field2: "本地控制器",
                field3: "总体",
                field4: "发送控制命令时延",
                field5: "正常",
              },{
                id: 1116,
                field1: "51100",
                field2: "本地控制器",
                field3: "总体",
                field4: "独立运行功能测试",
                field5: "正常",
              },{
                id: 1117,
                field1: "51100",
                field2: "本地控制器",
                field3: "总体",
                field4: "通信功能",
                field5: "正常",
              },{
                id: 1118,
                field1: "51100",
                field2: "本地控制器",
                field3: "总体",
                field4: "传输性能",
                field5: "正常",
              },{
                id: 1119,
                field1: "51100",
                field2: "本地控制器",
                field3: "总体",
                field4: "自检功能检查",
                field5: "正常",
              },],
            },
            ],
          },{
            id:12,
            field1: "51200",
            field2: "横通道门",
            field3: " ",
            field4: " ",
            field5: " ",
            children: [{
              id: 121,
              field1: "51200",
              field2: "横通道门",
              field3: "总体",
              children: [{
                id: 1211,
                field1: "51200",
                field2: "横通道门",
                field3: "总体",
                field4: "是否损坏",
                field5: "正常",
              }, {
                id: 1212,
                field1: "51200",
                field2: "横通道门",
                field3: "总体",
                field4: "开关是否自如",
                field5: "正常",
              },],
            },
            ],
          },{
            id:13,
            field1:"51300",
            field2:"横通道控制箱",
            field3:" ",
            field4:" ",
            field5:" ",
            children: [{
              id: 131,
              field1: "51300",
              field2: "横通道控制箱",
              field3: "总体",
              children: [{
                id: 1311,
                field1: "51300",
                field2: "横通道控制箱",
                field3: "总体",
                field4: "可编控制程序是否正确",
                field5: "正常",
              }, {
                id: 1312,
                field1: "51300",
                field2: "横通道控制箱",
                field3: "总体",
                field4: "自动及手动操作是否正确",
                field5: "正常",
              },],
            },]
          },{
            id:14,
            field1: "514XX",
            field2: "交通控制和诱导设施",
            field3: " ",
            field4: " ",
            field5: " ",
            children: [{
              id: 141,
              field1: "51401",
              field2: "交通控制和诱导设施",
              field3: "可变信息标志",
              children: [{
                id: 1411,
                field1: "51401",
                field2: "交通控制和诱导设施",
                field3: "可变信息标志",
                field4: "外观检查",
                field5: "正常",
              },{
                id: 1412,
                field1: "51401",
                field2: "交通控制和诱导设施",
                field3: "可变信息标志",
                field4: "查找不良像素管",
                field5: "正常",
              },{
                id: 1413,
                field1: "51401",
                field2: "交通控制和诱导设施",
                field3: "可变信息标志",
                field4: "清洁像素管、电路板",
                field5: "正常",
              },{
                id: 1414,
                field1: "51401",
                field2: "交通控制和诱导设施",
                field3: "可变信息标志",
                field4: "运行检测程序检测整体性能",
                field5: "正常",
              },{
                id: 1415,
                field1: "51401",
                field2: "交通控制和诱导设施",
                field3: "可变信息标志",
                field4: "各接线端子是否松动",
                field5: "正常",
              },{
                id: 1416,
                field1: "51401",
                field2: "交通控制和诱导设施",
                field3: "可变信息标志",
                field4: "更换像素管",
                field5: "正常",
              },{
                id: 1417,
                field1: "51401",
                field2: "交通控制和诱导设施",
                field3: "可变信息标志",
                field4: "紧固连接螺栓",
                field5: "正常",
              },],
            },{
              id: 142,
              field1: "51402",
              field2: "交通控制和诱导设施",
              field3: "可变限速标志",
              children: [{
                id: 1421,
                field1: "51402",
                field2: "交通控制和诱导设施",
                field3: "可变限速标志",
                field4: "外观检查",
                field5: "正常",
              },{
                id: 1422,
                field1: "51402",
                field2: "交通控制和诱导设施",
                field3: "可变限速标志",
                field4: "查找不良像素管",
                field5: "正常",
              },{
                id: 1423,
                field1: "51402",
                field2: "交通控制和诱导设施",
                field3: "可变限速标志",
                field4: "清洁像素管、电路板",
                field5: "正常",
              },{
                id: 1424,
                field1: "51402",
                field2: "交通控制和诱导设施",
                field3: "可变限速标志",
                field4: "运行检测程序检测整体性能",
                field5: "正常",
              },{
                id: 1425,
                field1: "51402",
                field2: "交通控制和诱导设施",
                field3: "可变限速标志",
                field4: "各接线端子是否松动",
                field5: "正常",
              },{
                id: 1426,
                field1: "51402",
                field2: "交通控制和诱导设施",
                field3: "可变限速标志",
                field4: "更换像素管",
                field5: "正常",
              }, ],
            },{
              id: 143,
              field1: "51403",
              field2: "交通控制和诱导设施",
              field3: "车道指示器",
              children: [{
                id: 1431,
                field1: "51403",
                field2: "交通控制和诱导设施",
                field3: "车道指示器",
                field4: "外观检查",
                field5: "正常",
              }, {
                id: 1432,
                field1: "51403",
                field2: "交通控制和诱导设施",
                field3: "车道指示器",
                field4: "查找不良像素管",
                field5: "正常",
              },{
                id: 1433,
                field1: "51403",
                field2: "交通控制和诱导设施",
                field3: "车道指示器",
                field4: "清洁像素管、电路板",
                field5: "正常",
              },{
                id: 1434,
                field1: "51403",
                field2: "交通控制和诱导设施",
                field3: "车道指示器",
                field4: "各接线端子是否松动",
                field5: "正常",
              },{
                id: 1435,
                field1: "51403",
                field2: "交通控制和诱导设施",
                field3: "车道指示器",
                field4: "更换像素管",
                field5: "正常",
              },{
                id: 1436,
                field1: "51403",
                field2: "交通控制和诱导设施",
                field3: "车道指示器",
                field4: "紧固连接螺栓",
                field5: "正常",
              },],
            },{
              id: 144,
              field1: "51404",
              field2: "交通控制和诱导设施",
              field3: "交通信号灯",
              children: [{
                id: 1441,
                field1: "51404",
                field2: "交通控制和诱导设施",
                field3: "交通信号灯",
                field4: "外观检查",
                field5: "正常",
              },{
                id: 1442,
                field1: "51404",
                field2: "交通控制和诱导设施",
                field3: "交通信号灯",
                field4: "查找不良像素管",
                field5: "正常",
              },{
                id: 1443,
                field1: "51404",
                field2: "交通控制和诱导设施",
                field3: "交通信号灯",
                field4: "清洁像素管、电路板",
                field5: "正常",
              },{
                id: 1444,
                field1: "51404",
                field2: "交通控制和诱导设施",
                field3: "交通信号灯",
                field4: "各接线端子是否松动",
                field5: "正常",
              },{
                id: 1445,
                field1: "51404",
                field2: "交通控制和诱导设施",
                field3: "交通信号灯",
                field4: "更换像素管",
                field5: "正常",
              },],
            },
            ],
          },{
            id:15,
            field1: "515XX",
            field2: "通信设施",
            field3: " ",
            field4: " ",
            field5: " ",
            children: [{
              id: 151,
              field1: "51501",
              field2: "通信设施",
              field3: "光缆、电缆",
              children: [{
                id: 1511,
                field1: "51501",
                field2: "通信设施",
                field3: "光缆、电缆",
                field4: "光缆、电缆线路巡视检查",
                field5: "正常",
              },{
                id: 1512,
                field1: "51501",
                field2: "通信设施",
                field3: "光缆、电缆",
                field4: "尾纤（缆)、终端盒、配线架外观检查",
                field5: "正常",
              },{
                id: 1513,
                field1: "51501",
                field2: "通信设施",
                field3: "光缆、电缆",
                field4: "人孔内检查",
                field5: "正常",
              },{
                id: 1514,
                field1: "51501",
                field2: "通信设施",
                field3: "光缆、电缆",
                field4: "光纤通道后向散射信号曲线测试检查",
                field5: "正常",
              },{
                id: 1515,
                field1: "51501",
                field2: "通信设施",
                field3: "光缆、电缆",
                field4: "电缆绝缘电阻测试",
                field5: "正常",
              },{
                id: 1516,
                field1: "51501",
                field2: "通信设施",
                field3: "光缆、电缆",
                field4: "光缆、电缆防雷和接地装置检查",
                field5: "正常",
              },],
            },{
              id: 152,
              field1: "51502",
              field2: "通信设施",
              field3: "光端机",
              children: [{
                id: 1521,
                field1: "51502",
                field2: "通信设施",
                field3: "光端机",
                field4: "发送光功率",
                field5: "正常",
              },{
                id: 1522,
                field1: "51502",
                field2: "通信设施",
                field3: "光端机",
                field4: "光接收灵敏度",
                field5: "正常",
              },{
                id: 1523,
                field1: "51502",
                field2: "通信设施",
                field3: "光端机",
                field4: "传输误码率",
                field5: "正常",
              }, ],
            },{
              id: 153,
              field1: "51503",
              field2: "通信设施",
              field3: "路由器、交换机",
              children: [{
                id: 1531,
                field1: "51503",
                field2: "通信设施",
                field3: "路由器、交换机",
                field4: "设备运行情况和网络运行数据检查",
                field5: "正常",
              },{
                id: 1532,
                field1: "51503",
                field2: "通信设施",
                field3: "路由器、交换机",
                field4: "告警显示检查",
                field5: "正常",
              },{
                id: 1533,
                field1: "51503",
                field2: "通信设施",
                field3: "路由器、交换机",
                field4: "路由器的路由表和端口流量检查",
                field5: "正常",
              },{
                id: 1534,
                field1: "51503",
                field2: "通信设施",
                field3: "路由器、交换机",
                field4: "交换机的 VLAN表和端口流量检查",
                field5: "正常",
              },{
                id: 1535,
                field1: "51503",
                field2: "通信设施",
                field3: "路由器、交换机",
                field4: "散热风扇检查",
                field5: "正常",
              },],
            },
            ],
          },{
            id:16,
            field1: "51600",
            field2: "监控室设备及系统",
            field3: " ",
            field4: " ",
            field5: " ",
            children: [{
              id: 161,
              field1: "51600",
              field2: "监控室设备及系统",
              field3: "总体",
              children: [{
                id: 1611,
                field1: "51600",
                field2: "监控室设备及系统",
                field3: "总体",
                field4: "各部位清洁检查",
                field5: "正常",
              },{
                id: 1612,
                field1: "51600",
                field2: "监控室设备及系统",
                field3: "总体",
                field4: "各部位的电压、电流检查",
                field5: "正常",
              },{
                id: 1613,
                field1: "51600",
                field2: "监控室设备及系统",
                field3: "总体",
                field4: "发热检查",
                field5: "正常",
              },{
                id: 1614,
                field1: "51600",
                field2: "监控室设备及系统",
                field3: "总体",
                field4: "病毒的防治",
                field5: "正常",
              },{
                id: 1615,
                field1: "51600",
                field2: "监控室设备及系统",
                field3: "总体",
                field4: "系统启动的动作确认",
                field5: "正常",
              },{
                id: 1616,
                field1: "51600",
                field2: "监控室设备及系统",
                field3: "总体",
                field4: "控制软件维护与系统联动",
                field5: "正常",
              },{
                id: 1617,
                field1: "51600",
                field2: "监控室设备及系统",
                field3: "总体",
                field4: "打印设备状况检查",
                field5: "正常",
              },{
                id: 1618,
                field1: "51600",
                field2: "监控室设备及系统",
                field3: "总体",
                field4: "系统时钟检查",
                field5: "正常",
              },{
                id: 1619,
                field1: "51600",
                field2: "监控室设备及系统",
                field3: "总体",
                field4: "硬件设备运行状况检查",
                field5: "正常",
              },{
                id: 16110,
                field1: "51600",
                field2: "监控室设备及系统",
                field3: "总体",
                field4: "设备功能与工作状态检查",
                field5: "正常",
              },{
                id: 16111,
                field1: "51600",
                field2: "监控室设备及系统",
                field3: "总体",
                field4: "数据保存、备份设备检查",
                field5: "正常",
              },],
            },],
          },{
            id:17,
            field1: "51700",
            field2: "监控室",
            field3: " ",
            field4: " ",
            field5: " ",
            children: [{
              id: 171,
              field1: "51700",
              field2: "监控室",
              field3: "总体",
              children: [{
                id: 1711,
                field1: "51700",
                field2: "监控室",
                field3: "总体",
                field4: "温湿度及清洁检查",
                field5: "正常",
              }, {
                id: 1712,
                field1: "51700",
                field2: "监控室",
                field3: "总体",
                field4: "地板抗静电检查",
                field5: "正常",
              },],
            },],
          },];
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        field1: null,
        field2: null,
        field3: null,
        field4: null,
        field5: null,
        field6: null,
        field7: null,
        field8: null,
        field9: null,
        field10: null,
        type: null,
        num: null,
        status: "0",
        delFlag: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,

      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.id);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加机电设施日常巡查";
    },
    /** 编辑/查看按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids;
      getJdssrcxc(id).then((response) => {
        this.form = response.data;
        this.open = true;
        this.title = "修改机电设施日常巡查";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          const {field4,...data } = this.form
          data['field4'] = field4[1]
          if (this.form.id != null) {
            updateJdssrcxc(data).then((response) => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addJdssrcxc(data).then((response) => {
              this.$modal.msgSuccess("添加成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除机电设施日常巡查单号为"' + ids + '"的数据项？').then(function() {
        return delJdssrcxc(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      })
        .catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams;
      this.$modal
        .confirm("是否确认导出所有监控与通信数据项？")
        .then(() => {
          this.exportLoading = true;
          return exportJiankongyutongxin(queryParams);
        })
        .then((response) => {
          this.download(response.msg);
          this.exportLoading = false;
        })
        .catch(() => {});
    },
  },
};
</script>
